package task1;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Random;

public class ArrayToCollectionCopy<T> {
	private static final int DEFAULT_ELEMENTS_QUANTITY = 5;

	public static <T> void fromArrayToCollection(T[] a, Collection<T> c) {
		for (T o : a) {
	        c.add(o);
	    }
	}

	public static void main(String[] args) {
		Random r = new Random();

		Integer[] intArr = new Integer[DEFAULT_ELEMENTS_QUANTITY];
		ArrayList<Integer> intArrList = new ArrayList<Integer>();

		for (int i = 0; i < DEFAULT_ELEMENTS_QUANTITY; i++) {
			intArr[i] = new Integer(r.nextInt(100));
			System.out.print(intArr[i].toString() + " ");
		}

		fromArrayToCollection(intArr, intArrList);
		System.out.println("\n" + intArrList.toString());
	}
}
